package com.yixing.tech.datasync.util.convert;

import com.yixing.tech.common.convert.Converter;

import java.math.BigDecimal;

import static java.lang.Double.valueOf;

/**
 * The class to convert {@link String} to {@link Double}
 */
public class BigDecimalToDoubleConverter implements Converter<BigDecimal, Double> {

    @Override
    public Double convert(BigDecimal source) {
        return source != null ? source.doubleValue() : null;
    }

    @Override
    public Class<BigDecimal> getSourceType() {
        return BigDecimal.class;
    }

    @Override
    public Class<Double> getTargetType() {
        return Double.class;
    }

}
